package com.kepler.social.common.utils;

import java.util.UUID;

public class FileUtil {

    public static boolean isImage(String mimeType) {
        return mimeType != null && mimeType.startsWith("image/");
    }

    public static boolean isVideo(String mimeType) {
        return mimeType != null && mimeType.startsWith("video/");
    }

    public static String uniFileName(String originalFileName) {
        String fileName = originalFileName.substring(0, originalFileName.lastIndexOf("."))
                + "_" + UUID.randomUUID().toString().replaceAll("-", "")
                + originalFileName.substring(originalFileName.lastIndexOf("."));
        return fileName;
    }

}
